<template>
    <a-modal
            :title="title"
            :width="width"
            :visible="visible"
            switchFullscreen
            @cancel="handleCancel"
            class="printData"
            :dialog-style="{ top: '5px'}"
    >
        <template slot="footer">
            <a-button key="back" @click="handleCancel">
                关闭
            </a-button>
        </template>
        <div v-if="visible">
            <a-table

                    ref="table"
                    size="middle"
                    bordered
                    rowKey="id"
                    :columns="columns"
                    :dataSource="dataSource"
                    :pagination="ipagination"
                    :loading="loading"
                    class="j-table-force-nowrap"
                    @change="handleTableChange"
            >
                <template slot="htmlSlot" slot-scope="text">
                    <div v-html="text"></div>
                </template>
            </a-table>
        </div>
    </a-modal>
</template>

<script>
    /**
     * create by Jane
     */
    import '@/assets/less/TableExpand.less'
    import { JeecgListMixin } from '@/mixins/JeecgListMixin'

    export default {
        mixins: [JeecgListMixin],
        data() {
            return {
                title: '机构超时提交废物详细记录',
                width: '80%',
                visible: false,
                // 表头
                columns: [
                    {
                        title: '序号',
                        dataIndex: '',
                        key: 'rowIndex',
                        width: 60,
                        align: 'center',
                        customRender: function(t, r, index) {
                            return parseInt(index) + 1
                        }
                    },
                    {
                        title: '记录时间',
                        align: 'center',
                        dataIndex: 'createTime'
                    },
                    {
                        title: '机构名称',
                        align: 'center',
                        dataIndex: 'customerName'
                    },
                    {
                        title: '最后提交的时间',
                        align: 'center',
                        dataIndex: 'lastSubmitTime'
                    },
                ],
                url: {
                    list: null
                }
            }
        },
        methods: {
            async show(cus,dateString) {
                let userInfo = this.$store.getters.userInfo
                if (userInfo.companysId) {
                    this.queryParam.companysId = userInfo.companysId
                }
                if (cus.customerName) {
                    this.title = `【${cus.customerName}】超时提交废物详细记录`
                } else {
                    this.title = '超时提交废物详细记录'
                }
                this.queryParam.creatTimeBegin = dateString[0]
                this.queryParam.creatTimeEnd = dateString[1]
                this.visible = true
                this.url.list = '/hc/hcRecycleSubmitWarning/getSubmitWarningByCustomerNumber';
                if (cus && cus.customerNumber) {
                    this.queryParam.customerNumber = cus.customerNumber;
                    this.loadData(1)
                }
            },
            close() {
                this.$emit('close')
                this.visible = false
            },
            handleOk() {
                this.close()
            },
            handleCancel() {
                this.close()
            },
            handleEdit() {

            }
        }
    }
</script>
<style scoped>
    @import '~@assets/less/common.less';
</style>
